var GTBase = {
  Version : '0.1'
};

function swapImages(image, newsrc) {
    image.src = newsrc;
}

function preloadImages() {
    var i = new Image;
    $A(arguments).each(function(s) { i.src = s; });
}

// TODO: popup stuff should be encapsulated in an object

function isUndefined(v) {
    var undef;
    return v===undef;
}

var _POPUP_FEATURES = 'location=0, statusbar=1, menubar=1, scrollbars=1, width=400, height=475';

function raw_popup(url, target, features) {
    if (isUndefined(features)) {
        features = _POPUP_FEATURES;
    }
    if (isUndefined(target)) {
        target = '_blank';
    }
    var theWindow = window.open(url, target, features);
    theWindow.focus();
    return theWindow;
}

function popup(src, features) {
    return raw_popup(src.getAttribute('href'), src.getAttribute('target') || '_blank', features);
}

// functions and classes end here. everything below this line gets executed when this document is loaded.

document.observe('dom:loaded', function() {
    // Install event handlers
    $('q').observe('focus', function() { $('q').value = ''; });
});
